#!/usr/bin/env bash

AMENITY_SCHEMAS=/usr/share/gconf/schemas/amenity.schemas
SHARE_DIR=/usr/share/amenity
AMENITY_DIR=`python -c "import sys; sys.path.pop(0); import amenity; print amenity.__path__[0]"`
AMENITY_SERVER=`which amenity-server`
if [ -f $AMENITY_SCHEMAS ]
    then
        export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
        gconftool-2 --makefile-uninstall-rule $AMENITY_SCHEMAS
        rm -v $AMENITY_SCHEMAS
fi
if [ -d $SHARE_DIR ]
    then
        rm -vrf $SHARE_DIR
fi
if [ -n $AMENITY_DIR ]
    then
        rm -vrf $AMENITY_DIR
fi
if [ -n $AMENITY_SERVER ]
    then
        rm -v $AMENITY_SERVER
fi
gconftool-2 --shutdown
gconftool-2 --spawn
